<template>
    <div class="moviesList">
        <div class="list" v-if="list.length > 0">
            <div class="item" v-for="(item, index) in list" :key="index" @click="toPath(item)">
                <van-image lazy-load :src="item.image" widht="100%"></van-image>
                <div class="van-ellipsis">{{ item.moviesName }}</div>
            </div>
        </div>
        <van-empty v-else></van-empty>
    </div>
</template>

<script>
    export default {
        props : {
            list : {
                default : [],
                type : Array,
            }
        },
        data() {
            return {
                
            }
        },
        methods: {
            toPath(item){
                this.$router.push('/moviesDetail?id=' + item.moviesId)
            }
        },
    }
</script>

<style lang="less" scoped>
.moviesList{
    width: calc(100% - 20px);
    padding: 10px;
    .list{
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        .item{
            width: calc(50% - 4px);
            margin: 5px 2px;
            overflow: hidden;
            text-align: center;
            border-radius: 10px;
            font-size: 15px;
        }
    }
}
</style>